package com.example.custcomsumer.service;

import com.example.custcomsumer.entity.IObehave;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.List;

@Service
public class IObehaveService {
    @Autowired
    private RestTemplate restTemplate;

    public List<IObehave> selectIn(int currentPage, int pageSize) {
        return restTemplate.getForObject("http://custom-behave-provider/io-behave-provider/selectInBySql/" + currentPage + "/" + pageSize, List.class);
    }

    public List<IObehave> selectOut(int currentPage, int pageSize) {
        return restTemplate.getForObject("http://custom-behave-provider/io-behave-provider/selectOutBySql/" + currentPage + "/" + pageSize, List.class);
    }

    public Integer getInTotal() {
        return restTemplate.getForObject("http://custom-behave-provider/io-behave-provider/getInTotal", Integer.class);
    }

    public Integer getOutTotal() {
        return restTemplate.getForObject("http://custom-behave-provider/io-behave-provider/getOutTotal", Integer.class);
    }
}
